package com.easy.stock.spider;

import org.jboss.netty.channel.Channel;


/**
 * 表示单个抓取任务
 * 
 * @author simonlin
 */
public class SpiderTask {
	
	public static enum STATUS {
		RUNNING,
		READY,
		FAILED,
		SUCCESS,
	}

	private String url;
	
	private HttpResponseHandler handler;

	private Channel channel;

	private STATUS status;
	
	private int retryNum;
	
	private int startTs;
	
	public SpiderTask(String url, HttpResponseHandler handler, STATUS status) {
		this.url = url;
		this.handler = handler;
		handler.setTask(this);
		this.status = status;
	}
	
	public STATUS getStatus() {
		return status;
	}

	public void setStatus(STATUS status) {
		this.status = status;
	}

	public int getRetryNum() {
		return retryNum;
	}

	public void setRetryNum(int retryNum) {
		this.retryNum = retryNum;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Channel getChannel() {
		return channel;
	}

	public void setChannel(Channel channel) {
		this.channel = channel;
	}
	
	public HttpResponseHandler getHandler() {
		return handler;
	}

	public void setHandler(HttpResponseHandler handler) {
		this.handler = handler;
	}
	
	public int getStartTs() {
		return startTs;
	}

	public void setStartTs(int startTs) {
		this.startTs = startTs;
	}
}
